/*******************************************************************************
 * Copyright (c) 2008 Nels E. Beckman.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Nels E. Beckman - initial API and implementation
 *******************************************************************************/
package edu.cmu.cs.nbeckman.wptranslator;

/**
 * This is indented text.
 * 
 * @author Nels E. Beckman
 */
public class Indent implements Element {

	private static final String HTML_INDENT_AMOUNT = "1em";
	
	private static final String RTF_INDENT_AMOUNT = Integer.toString(720);  
	
	private final Element element;
	/**
	 * The number of characters this text is indented.
	 */
	@SuppressWarnings("unused")
	private final int charsIndented;
	
	public Indent(Element element, int charsIndented) {
		this.element = element;
		this.charsIndented = charsIndented;
	}
	
	public Indent(Element element2) {
		this(element2, 4);
	}

	@Override
	public String drawAsHTML() {
		StringBuffer result = new StringBuffer("<div style=\"padding-left:" + HTML_INDENT_AMOUNT + ";\">");
		result.append(element.drawAsHTML());
		result.append("</div>");
		return result.toString();
	}

	@Override
	public String drawAsRTF() {
		return "{\\li"+RTF_INDENT_AMOUNT + " " + element.toString() + " }";
	}
}
